<!-- right-->
<div class="member-main">
<div>

<div class="title"><span style="float:left"><{t}>我的收藏<{/t}></span></div>

<{if !$favorite}>
<div class="noinfo"><{t}>暂无收藏<{/t}></div>
<{else}>
<div class="GoodsSearchWrap" id="mbc-my-fav">
    <div class="ItemsWarp clearfix">
      <div id="b2c-member-fav-list">
        <{include file="site/member/favorite_items.html" app="b2c"}>
      </div>
    </div>
    <input type="hidden" id="b2c-fav-current-page" value="<{$current_page}>" />
</div>
<{pagers data=$pager}>
<{/if}>

<div class='FormWrap goods-compare' id='goods-compare' style='display:none'>
<div class='title'><h3><{t}>商品对比<{/t}><span class='close-gc' onclick='gcompare.hide()'><{t}>[关闭]<{/t}></span></h3></div>
   <form action='<{link app="b2c" ctl="site_product" act="diff"}>' method='post' target='_compare_goods'>
      <ul class='compare-box'>
         <li class='division clearfix tpl'>
            <div class='goods-name'>
               <a href='#' title='{gname}'>{gname}</a>
            </div>
            <span class='btn-delete' onclick='gcompare.erase("{gid}",this);'><{t}>删除<{/t}></span>
         </li>
      </ul>
      <div class='compare-bar' >
      <!-- <a class="btn-a btn-compare" name="comareing" onclick='gcompare.submit()'><span><{t}>对比<{/t}></span></a> -->
          <input type="button" name="comareing" onclick='gcompare.submit()' class="btn-compare" value="<{t}>对比<{/t}>">
          <input type="button" class="btn-compare" onclick="gcompare.empty()" value="<{t}>清空<{/t}>">
      </div>
   </form>
</div>
<!--<{script src='goodscupcake.js' app='b2c'}>-->
<script>
  $$('.btn-del-fav').addEvent('click', function(e){
    var gid = this.get('gid');
    Ex_Dialog.confirm('<{t}>确定删除?<{/t}>',function(e){
        if(!e) return false;
        new Request({
            url:'<{$fav_ajax_del_goods_url}>',
            method:'post',
            data:'t='+(+new Date())+'&gid='+gid+'&current='+$('b2c-fav-current-page').value,
            onComplete:function(res){
                res = JSON.decode(res);
                if (res.error){
                    MessageBox.error(res.error);
                }else{
                    if (!res.data&&res.reload){
                        location.href=res.reload;
                    }else{
                        $('b2c-member-fav-list').innerHTML = res.data;
                    }

                    /*new Fx.Tween($('goods_'+gid)).start('opacity',0).chain(function(){
                        // 暂时这样改.
                        if ($$('.itemsList')&&$$('.itemsList').length<=1) location.href=res.reload;
                        $('goods_'+gid).destroy();
                    });*/
                }
            }
        }).send();
        $('goods_'+gid).setOpacity(.5);
        var MEMBER=Cookie.read('S[MEMBER]');
        var FAVCOOKIE= new Cookie('S[GFAV]['+MEMBER+']',{duration:365});
        FAVCOOKIE.write(Array.from((FAVCOOKIE.read('S[GFAV]')||'').split(',')).erase(gid).join(','));
        return false;
    });
  });
</script>

</div>
</div>
<!-- right-->
